package co.baiku.boot.common.tools;

import org.apache.commons.lang3.concurrent.BasicThreadFactory;

import java.util.concurrent.ScheduledThreadPoolExecutor;

public class ThreadPoolTools {

    public static ScheduledThreadPoolExecutor newScheduledThreadPool(int corePoolSize, String threadNamePrefix, boolean daemon) {
        return new ScheduledThreadPoolExecutor(corePoolSize, new BasicThreadFactory.Builder().namingPattern(threadNamePrefix + "%d").daemon(daemon).build());
    }
}
